

#include <stdint.h>
#include "phNfcLib.h"
#ifndef NDEBUG
#define NDEBUG 1
#endif
#include <Log.h>

int Desfire_Exchange(uint8_t *txBuffer, uint16_t txLength, uint8_t* rxBuffer, uint16_t* rxLength){
		phStatus_t	 statusTmp;
		uint8_t* pRecv;
		void* palI14443p4 = phNfcLib_GetDataParams(PH_COMP_PAL_ISO14443P4);
		LOG_BUF(0, RTT_CTRL_TEXT_BRIGHT_WHITE, "tx", txBuffer, txLength);
        PH_CHECK_SUCCESS_FCT(statusTmp,  phpalI14443p4_Exchange(
            palI14443p4,
            PH_EXCHANGE_DEFAULT,
            txBuffer,
            txLength,
            &pRecv,
            rxLength));
		memcpy(rxBuffer, pRecv, *rxLength);
		LOG_BUF(0, RTT_CTRL_TEXT_BRIGHT_WHITE, "rx", rxBuffer, *rxLength);
		return 0;
}




